//
//  MantisLeftTextTableViewCell.m
//  NLProjectFrameworkDemo
//
//  Created by iosdeveloper on 2020/5/8.
//  Copyright © 2020 yj_zhang. All rights reserved.
//

#import "MantisLeftTextTableViewCell.h"

@implementation MantisLeftTextTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpView];
    }
    return self;
}


-(void)setUpView{
    [super setUpView];
    self.bgView.backgroundColor=[UIColor whiteColor];

}
-(void)reloadCellModel:(MantisCellBaseModel *)data{
    [super reloadCellModel:data];
    MantisTextCellData*newData=( MantisTextCellData*)data;
    if (newData.inputStr.length>0) {
        self.contentLabel.attributedText=newData.inputStr;
    }else{
       self.contentLabel.text=newData.content;
    }
    

    CGSize labelSize =newData.contentSize;
    CGSize bgSize = CGSizeMake(labelSize.width+10, labelSize.height+10);

       
    [self setThreeCorner:bgSize bgView:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
       make.left.equalTo(self.avaterView.mas_right).offset(adaptWidth750(20));
        make.size.mas_equalTo(bgSize);
        make.top.equalTo(self.avaterView);
    }];

    [self relayoutLabelSize:labelSize];
  
//    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(self.bgView);
//        make.centerY.equalTo(self.bgView);
//        make.size.mas_equalTo(labelSize);
//    }];

//    [self.contentLabel sizeThatFits:labelSize];
   
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
